import React, {Component} from 'react';
import {Document, Page} from 'react-pdf';

class PdfTest extends Component {
    constructor(props) {
        super(props);
        this.state = {
            numPages: null,
            pageNumber: 1,
        }
        this.onDocumentLoad = this.onDocumentLoad.bind(this);
    }

    onDocumentLoad(numPages) {
        this.setState({numPages});
    }

    render() {
        const {pageNumber, numPages} = this.state;
        return (
            <div>
                <Document
                    file='http://192.168.1.118:8099/download/pdf/%E9%9C%80%E6%B1%82%E5%8F%98%E6%9B%B4%E6%B1%87%E6%80%BB20180407(1).pdf'
                    onLoadSuccess={this.onDocumentLoad}>
                    <Page pageNumber={pageNumber}/>
                </Document>
                <p>Page {pageNumber} of {numPages}</p>
            </div>
        );
    }
}

export default PdfTest